/**
 * Resourece
 * @ 第一屏 杂项
 */
import { Base } from "@/pixi/base";
class Resourece extends Base {
  Resourece: any[];
  getSprites: any;
  isRendering: boolean;
  position: object | string;
  anchor: object | string;
  constructor() {
    super();
    this.Resourece = [];
    this.getSprites = {};
    this.load();
    this.position = {x: 1273, y: 0};
    // this.position = {x: -0, y: 0};
    this.anchor = "center";
    this.isRendering = true
  }
  load() {
    // 遍历资源
    const ResoureceNameList: string[] = [
      "p2-tree4",
      "p2-grass",
      "p2-school",
      "p2-shitou",
      "p2-huati",
      "p2-boy",
      "p2-wutai",
      "p2-lotsofyinfu",
      // "p2-yinfu",
      "p2-mother",
      "w1"
    ];
    for (let i = 0; i <= ResoureceNameList.length - 1; i++) {
      this.Resourece.push({
        name: `${ResoureceNameList[i].replace("-", "")}`,
        url: require(`@/${this.baseUrl}/images/${ResoureceNameList[i]}.png`),
      });
    }
    // 设置精灵
    for (let i = 0; i <= ResoureceNameList.length - 1; i++) {
      console.log(ResoureceNameList[i].replace("-", ""));
      this.getSprites[ResoureceNameList[i].replace("-", "")] = {
        key: `${ResoureceNameList[i].replace("-", "")}`,
        size: {mode:'widthFit', width: 0.5 },
        position: "center",
        anchor: "center",
        alpha: '1',
      };
    }
    this.getSprites.p2grass = {
      key: `p2grass`,
      size: {mode: "widthFit", width: 1.2  },
      position: {
        x: .45,
        y: .95
      },
      anchor: "bottom",
      alpha: '1',
    };
    this.getSprites.p2school = {
      key: `p2school`,
      size: {mode: "widthFit", width: 1.5  },
      position: {
        x: 1,
        y: 0
      },
      anchor: "top",
      alpha: '1',
    };
    this.getSprites.p2shitou = {
      key: `p2shitou`,
      size: {mode: "widthFit", width: 1  },
      position: {
        x: 1.45,
        y: .93
      },
      anchor: "bottom",
      alpha: '1',
    };
    this.getSprites.p2huati = {
      key: `p2huati`,
      size: {mode: "widthFit", width: 1.3  },
      position: {
        x: 1.45,
        y: 0.43
      },
      anchor: "top",
      alpha: '1',
    };
    this.getSprites.p2boy = {
      key: `p2boy`,
      size: {mode: "widthFit", width: .3  },
      position: {
        x: 1.3,
        y: 0.33
      },
      anchor: "top",
      alpha: '1',
    };
    this.getSprites.p2wutai = {
      key: `p2wutai`,
      size: {mode: "widthFit", width: 1.3  },
      position: {
        x: 2.7,
        y: .95
      },
      anchor: "bottom",
      alpha: '1',
    };
    this.getSprites.p2lotsofyinfu = {
      key: `p2lotsofyinfu`,
      size: {mode: "widthFit", width: 1.3  },
      position: {
        x: 2.5,
        y: .3
      },
      anchor: "center",
      alpha: '1',
    };
    // this.getSprites.p2yinfu = {
    //   key: `p2yinfu`,
    //   size: {mode: "widthFit", width: .5 },
    //   position: {
    //     x: 2.5,
    //     y: .3
    //   },
    //   anchor: "center",
    // };
    this.getSprites.p2tree4 = {
      key: `p2tree4`,
      size: {mode: "widthFit", width: 1.5 },
      position: {
        x: 2.5,
        y: .3
      },
      anchor: "center",
      alpha: '1',
    };
    this.getSprites.p2mother = {
      key: `p2mother`,
      size: {mode: "widthFit", width: .6 },
      position: {
        x: 0.3,
        y: .92
      },
      anchor: "bottom",
      alpha: '1',
    };
    this.getSprites.w1 = {
      key: `w1`,
      size: {mode: "widthFit", width: 3.8 },
      position: {
        x: 1.7,
        y: 1
      },
      anchor: "bottom",
      alpha: '1',
    };
  }
}
export default new Resourece();
